from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
#from ModuleDeliberation.models import Comment

#Topic: Category to place issues.
class Topic(models.Model):
    text = models.CharField(max_length=140)
    pub_date = models.DateTimeField('date published', auto_now_add=True)
    
    def __unicode__(self):
        return self.text[:20]

#A specific issue of political concern. Are authors important?
#This should be a pirate-wikipage instance
class Issue(models.Model):
    topic = models.ForeignKey(Topic)
    name = models.CharField(max_length=140)
    pub_date = models.DateTimeField('date_published',auto_now_add=True)
    text = models.CharField(max_length=1000)
    #comments = generic.GenericRelation(Comment)
    
    def __unicode__(self):
        return self.name

    def get_absolute_path(self):
        return 'issues/'+str(self.id)+'/'
 
